<?php
/**
 * Classe/DataForSynthese.php
 */

namespace Operationtest\Classe;

use Operationtest\Classe\OperationDate;

class DataForSynthese { 
    protected $operationDate;
    
    public function __construct() {
        $this->operationDate = new OperationDate();
    }
    
    public function caData($request) {
        $data = array();
        $dataSynthese = new Container('dataSynthese');
        $period = $this->operationDate->displayPeriod($request);
        
        foreach($period as $idxm => $month):
            foreach($month as $idxw => $week):
                foreach($week as $idxd => $day):
                $data[$day]['ca_ttc'] = $data[$day]['ca_ttc'] = 0;
                    foreach($dataSynthese->offsertGet('ca') as $ca):
                        $data[$day]['ca_ttc'] = $ca['ca_ttc'];
                        $data[$day]['ca_ht'] = $ca['ca_ht'];
                    endforeach;
                endforeach;
            endforeach;
        endforeach;
        
        return $data;
    }
}
